/**
 *
 * @param {number} n 求阶乘的数据
 * @returns { number } n的阶乘
 */
function factorial(n) {
  if (n < 1) return 0;
  if (n === 1) return 1;
  if (n > 1) return factorial(n - 1) * n;
}

console.log(factorial(3));

/**
 *
 * @param {Array} arr 要遍历的数组
 * @param {any} target 目标
 * @returns {boolean} 是否找到
 */
function includes(arr, target) {
  let ret = false;
  for (let i = 0; i < arr.length; i++) {
    const cur = arr[i];
    if (cur === target) {
      ret = true;
      break;
    }
  }
  return ret;
}
7;
console.log(includes([1, 2, 3, 40], 40));

const num1 = [1, 3, 8, 2, 5, 1, 9];
const num3 = [2, 5, 1];
console.log(num3.every((v) => num1.includes(v)));
